import { PromiseResponse, PromiseResponsePage } from '@/types/type'
import { MenuType } from './types'
import { request } from '@/utils/request'
import { PageQueryFormType, QueryFormType } from '@/types/queryform'

/* eslint-disable no-unused-vars */
enum API {
    GET_MENUS_URL = '/Menu/GetAll',
    GET_PAGE_MENUS_URL = '/Menu/GetPage',
    GET_MENU_BYID_URL = '/Menu/GetById',
}
/**
 * 获取所有
 * @param queryForm 查询表单
 * @returns 所有菜单数据
 */
export const getAllMenus = (queryForm?: QueryFormType<any>): PromiseResponse<MenuType[]> => request(API.GET_MENUS_URL, 'GET', {}, queryForm)
/**
 * 分页获取
 * @param queryForm 分页查询表单
 * @returns 分页菜单数据
 */
export const getPageMenus = (pageQueryForm?: PageQueryFormType<any>): PromiseResponsePage<MenuType[]> =>
    request(API.GET_PAGE_MENUS_URL, 'GET', {}, pageQueryForm)
/**
 * 根据id获取数据
 * @returns
 */
export const getMenuById = (): PromiseResponse<MenuType> => request(API.GET_MENU_BYID_URL)
